// pages/user/dingdan.js
//index.js  
//获取应用实例  
var app = getApp();
var common = require("../../utils/common.js");
Page({
  data: {
    tabArr: {
      curHdIndex: 0,
      curBdIndex: 0
    },
    kids: [
      {
        mei: '综合',

        id: '0',

      },
      {
        mei: '销量',
        id: '1'
      },
      {
        mei: '价格',
        id: '2'

      },
      {
        mei: '港澳',
        id: '3'

      }, {
        mei: '日韩',
        id: '4'

      },
    ],

    // tab切换  
    currentTab: 0,
    isStatus: 'pay',//10待付款，20待发货，30待收货 40、50已完成
    page: 2,
    refundpage: 2,
    orderList0: [],
    orderList1: [],
    orderId: 0
  },
  gao: function () {
    wx.navigateTo({
      url: '../detail/detail',
      success: function (res) { },
      fail: function (res) { },
      complete: function (res) { },
    })
  },
  // tab切换
  tabFun: function (e) {
    //获取触发事件组件的dataset属性 
    var _datasetId = e.target.dataset.id;
    console.log("----" + _datasetId + "----");
    var _obj = {};
    _obj.curHdIndex = _datasetId;
    _obj.curBdIndex = _datasetId;
    this.setData({
      tabArr: _obj
    });
  },

  kid: function (res) {
    //获取触发事件组件的dataset属性 

    var _datasetId = res.currentTarget.dataset.id;
    var _obj;
    console.log(_datasetId)
    _obj = _datasetId;

    this.setData({
      lei: _obj
    });
  }, 
  onLoad: function (options) {

  },


  //取消收藏
  removeOrder: function (e) {
    var that = this;
    var orderId = e.currentTarget.dataset.orderId;
    wx.showModal({
      title: '提示',
      content: '你确定要取消收藏吗？',
      success: function (res) {
        res.confirm && wx.request({
          url: app.d.ceshiUrl + '/Api/Order/orders_edit',
          method: 'post',
          data: {
            id: orderId,
            type: 'cancel',
          },
          header: {
            'Content-Type': 'application/x-www-form-urlencoded'
          },
          success: function (res) {
            //--init data
            var status = res.data.status;
            if (status == 1) {
              wx.showToast({
                title: '操作成功！',
                duration: 2000
              });
              that.loadOrderList();
            } else {
              wx.showToast({
                title: res.data.err,
                duration: 2000
              });
            }
          },
          fail: function () {
            // fail
            wx.showToast({
              title: '网络异常！',
              duration: 2000
            });
          }
        });

      }
    });
  },




})